package com.pcitc.app.model;

import com.pcitc.app.model.BaseObject;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;

import java.io.Serializable;

@Entity
@Table(name="TBL_ROLE_MENU",schema="XZGD")
public class TblRoleMenu extends BaseObject implements Serializable {
    private Long rmkid;
    private TblRole tblRole;
    private Long menuid;

    @Id  @GeneratedValue(strategy = GenerationType.AUTO)    
    public Long getRmkid() {
        return this.rmkid;
    }
    
    public void setRmkid(Long rmkid) {
        this.rmkid = rmkid;
    }
@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="ROLEID")
    public TblRole getTblRole() {
        return this.tblRole;
    }
    
    public void setTblRole(TblRole tblRole) {
        this.tblRole = tblRole;
    }
    
    @Column(name="MENUID", precision=22, scale=0)
    public Long getMenuid() {
        return this.menuid;
    }
    
    public void setMenuid(Long menuid) {
        this.menuid = menuid;
    }

    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TblRoleMenu pojo = (TblRoleMenu) o;

        if (tblRole != null ? !tblRole.equals(pojo.tblRole) : pojo.tblRole != null) return false;
        if (menuid != null ? !menuid.equals(pojo.menuid) : pojo.menuid != null) return false;

        return true;
    }

    public int hashCode() {
        int result = 0;
        result = (tblRole != null ? tblRole.hashCode() : 0);
        result = 31 * result + (menuid != null ? menuid.hashCode() : 0);

        return result;
    }

    public String toString() {
        StringBuffer sb = new StringBuffer(getClass().getSimpleName());

        sb.append(" [");
        sb.append("rmkid").append("='").append(getRmkid()).append("', ");
        sb.append("tblRole").append("='").append(getTblRole()).append("', ");
        sb.append("menuid").append("='").append(getMenuid()).append("'");
        sb.append("]");
      
        return sb.toString();
    }

}
